package com.info.zhiduoduo.wxsdk.api;

public interface WxUrl {

	/** 小程序:登录微信小程序的url */
	String LOGIN_MINI_PROGRAM = "https://api.weixin.qq.com/sns/jscode2session?" +
			"appid=%1$s&secret=%2$s&js_code=%3$s&grant_type=authorization_code";

	/** 网站应用/公众号:通过网页授权接口专门的调用凭证 获取微信用户信息 */
	String AUTHORIZE_USERINFO = "https://api.weixin.qq.com/sns/userinfo?access_token=%1$s&openid=%2$s&lang=zh_CN";

	/** 通用:通过普通的接口调用凭证 获取微信用户信息 */
	String NORMAL_USERINFO = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=%1$s&openid=%2$s&lang=zh_CN ";

	/** 网站应用/公众号:根据code获取专门的网页授权凭证token */
	String AUTHORIZE_ACCESS_TOKEN = "https://api.weixin.qq.com/sns/oauth2/access_token?" +
			"appid=%1$s&secret=%2$s&code=%3$s&grant_type=authorization_code";

	/** 网站应用/公众号:刷新网页授权凭证token */
	String REFRESH_AUTHORIZE_ACCESS_TOKEN = "https://api.weixin.qq.com/sns/oauth2/refresh_token?" +
			"appid=%1$s&grant_type=refresh_token&refresh_token=REFRESH_TOKEN";

	/** 公众号应用 请求获取或刷新普通AccessToken */
	String REFRESH_NORMAL_ACCESS_TOKEN = "https://api.weixin.qq.com/cgi-bin/token?" +
			"grant_type=client_credential&appid=%1$s&secret=%2$s";

	/** 公众号应用 获取js凭证 */
	String JS_TICKET = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=%1$s&type=jsapi";

	/** 公众号应用 post方式发送模板消息 */
	String SEND_TEMPLETE_MESSAGE = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=%1$s";

	/** 公众号应用 post方式发送红包给用户,数据为xml格式 */
	String SEND_RED_PACKET = "https://api.mch.weixin.qq.com/mmpaymkttransfers/sendredpack";

	static String getLoginMiniProgramUrl(String appid, String secret, String code) {
		return String.format(LOGIN_MINI_PROGRAM, appid, secret, code);
	}

	static String getAuthorizeUserinfoUrl(String accessToken, String openid) {
		return String.format(AUTHORIZE_USERINFO, accessToken, openid);
	}

	static String getNormalUserInfoUrl(String accessToken, String openid) {
		return String.format(NORMAL_USERINFO, accessToken, openid);
	}

	static String getAuthorizeAccessTokenUrl(String appid, String secret, String code) {
		return String.format(AUTHORIZE_ACCESS_TOKEN, appid, secret, code);
	}

	static String getRefreshAuthorizeAccessTokenUrl(String openid) {
		return String.format(REFRESH_AUTHORIZE_ACCESS_TOKEN, openid);
	}

	static String getRefreshNormalAccessTokenUrl(String appid, String secret) {
		return String.format(REFRESH_NORMAL_ACCESS_TOKEN, appid, secret);
	}

	static String getJsTicketUrl(String accessToken) {
		return String.format(JS_TICKET, accessToken);
	}

	static String getSendTempleteMessageUrl(String accessToken) {
		return String.format(SEND_TEMPLETE_MESSAGE, accessToken);
	}

	static String getSendRedPacketUrl() {
		return SEND_RED_PACKET;
	}
}
